load("//tools:create-system-config.bzl", "create_system_config")
load("//tools:defaults.bzl", "ts_library")

package(default_visibility = ["//visibility:public"])

exports_files(["bazel-karma-local-config.js"])

# Common set-up for all Angular Material and CDK tests.
ts_library(
    name = "angular_test_init",
    testonly = True,
    # This file *must* end with "spec" in order for "karma_web_test_suite" to load it.
    srcs = ["angular-test-init-spec.ts"],
    deps = [
        "@npm//@angular/core",
        "@npm//@angular/platform-browser-dynamic",
        "@npm//@types/jasmine",
    ],
)

# Creates a SystemJS configuration file that can be used for the Karma legacy
# unit tests. This allows us to only have one canonical SystemJS configuration
# file, and we don't need to repeat package/entry-point configurations.
create_system_config(
    name = "system-config",
    base_url = "base/",
    node_modules_base_path = "node_modules/",
    output_name = "system-config.js",
    packages_dir = "dist/packages",
)
